import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity('payment_info',{database:'daijia_payment'}) // 指定数据库表名
export class PaymentInfo {
  @ApiProperty({ description: '支付记录ID', example: 1 })
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', unsigned: true, comment: '支付记录ID' })
  id: number;

  @ApiProperty({ description: '用户OpenID', example: 'user_open_id_12345', required: false })
  @Column({ type: 'varchar', length: 50, nullable: true, comment: '用户OpenID' })
  customer_open_id: string;

  @ApiProperty({ description: '司机OpenID', example: 'driver_open_id_67890', required: false })
  @Column({ type: 'varchar', length: 50, nullable: true, comment: '司机OpenID' })
  driver_open_id: string;

  @ApiProperty({ description: '订单编号', example: 'ORDER123456789' })
  @Column({ type: 'varchar', length: 50, nullable: false, unique: true, comment: '订单编号' })
  order_no: string;

  @ApiProperty({ description: '支付方式：0-未支付，1-微信支付，2-支付宝，3-其他', example: 1 })
  @Column({ type: 'tinyint', nullable: false, default: 0, comment: '支付方式' })
  pay_way: number;

  @ApiProperty({ description: '交易ID', example: 'TXN123456789', required: false })
  @Column({ type: 'varchar', length: 50, nullable: true, comment: '交易ID' })
  transaction_id: string;

  @ApiProperty({ description: '支付金额（单位：元）', example: 50.0, required: false })
  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true, comment: '支付金额' })
  amount: number;

  @ApiProperty({ description: '支付内容描述', example: '订单支付成功', required: false })
  @Column({ type: 'varchar', length: 200, nullable: true, comment: '支付内容描述' })
  content: string;

  @ApiProperty({ description: '支付状态：0-未支付，1-支付成功，2-支付失败', example: 1, required: false })
  @Column({ type: 'tinyint', nullable: true, comment: '支付状态' })
  payment_status: number;

  @ApiProperty({ description: '回调时间', example: '2023-01-01T12:00:00Z', required: false })
  @Column({ type: 'datetime', nullable: true, comment: '回调时间' })
  callback_time: Date;

  @ApiProperty({ description: '回调内容', example: '支付成功的详细信息', required: false })
  @Column({ type: 'text', nullable: true, comment: '回调内容' })
  callback_content: string;

  @ApiProperty({ description: '创建时间', example: '2023-01-01T12:00:00Z' })
  @CreateDateColumn({
    type: 'timestamp',
     comment: '创建时间',
  })
  create_time: Date;

  @ApiProperty({ description: '更新时间', example: '2023-01-01T12:00:00Z' })
  @UpdateDateColumn({
    type: 'timestamp',
     comment: '更新时间',
  })
  update_time: Date;

  @ApiProperty({ description: '是否删除：0-未删除，1-已删除', example: 0 })
  @Column({ type: 'tinyint', nullable: false, default: 0, comment: '是否删除' })
  is_deleted: number;
}